<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Loader - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">Loader</h1>
		<section>
			<header>
				<div class="class-description"><p>Abstract base class for loaders.</p></div>
			</header>
			<article>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="Loader" translate="no">new <a href="#Loader">Loader</a><span class="signature">( manager : <span class="param-type"><a href="LoadingManager.html">LoadingManager</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new loader.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>manager</strong>
									</td>
									<td class="description last">
										<p>The loading manager.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="crossOrigin" translate="no">.<a href="#crossOrigin">crossOrigin</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The crossOrigin string to implement CORS for loading the url from a
different domain that allows CORS.</p>
						<p>Default is <code>'anonymous'</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="manager" translate="no">.<a href="#manager">manager</a><span class="type-signature"> : <a href="LoadingManager.html">LoadingManager</a></span> </h3>
					<div class="description">
						<p>The loading manager.</p>
						<p>Default is <code>DefaultLoadingManager</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="path" translate="no">.<a href="#path">path</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The base path from which the asset will be loaded.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="requestHeader" translate="no">.<a href="#requestHeader">requestHeader</a><span class="type-signature"> : Object.&lt;string, <a href="global.html#any">any</a>></span> </h3>
					<div class="description">
						<p>The <a href="https://developer.mozilla.org/en-US/docs/Glossary/Request_header" target="_blank" rel="noopener">request header</a>
used in HTTP request.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="resourcePath" translate="no">.<a href="#resourcePath">resourcePath</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The base path from which additional resources like textures will be loaded.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="withCredentials" translate="no">.<a href="#withCredentials">withCredentials</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>Whether the XMLHttpRequest uses credentials.</p>
						<p>Default is <code>false</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id=".DEFAULT_MATERIAL_NAME" translate="no">.<a href="#.DEFAULT_MATERIAL_NAME">DEFAULT_MATERIAL_NAME</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The default material name that is used by loaders
when creating materials for loaded 3D objects.</p>
<p>Note: Not all loaders might honor this setting.</p>
						<p>Default is <code>'__DEFAULT'</code>.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="abort" translate="no">.<a href="#abort">abort</a><span class="signature">()</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> <span class="type-signature">(abstract) </span></h3>
					<div class="method">
						<div class="description">
							<p>This method can be implemented in loaders for aborting ongoing requests.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type"><a href="global.html#onProgressCallback">onProgressCallback</a></span>, onError : <span class="param-type"><a href="global.html#onErrorCallback">onErrorCallback</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
					<div class="method">
						<div class="description">
							<p>This method needs to be implemented by all concrete loaders. It holds the
logic for loading assets from the backend.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>url</strong>
									</td>
									<td class="description last">
										<p>The path/URL of the file to be loaded.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>onLoad</strong>
									</td>
									<td class="description last">
										<p>Executed when the loading process has been finished.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>onProgress</strong>
									</td>
									<td class="description last">
										<p>Executed while the loading is in progress.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>onError</strong>
									</td>
									<td class="description last">
										<p>Executed when errors occur.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="loadAsync" translate="no">.<a href="#loadAsync">loadAsync</a><span class="signature">( url : <span class="param-type">string</span>, onProgress : <span class="param-type"><a href="global.html#onProgressCallback">onProgressCallback</a></span> )</span><span class="type-signature"> : Promise</span> </h3>
					<div class="method">
						<div class="description">
							<p>A async version of <a href="Loader.html#load">Loader#load</a>.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>url</strong>
									</td>
									<td class="description last">
										<p>The path/URL of the file to be loaded.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>onProgress</strong>
									</td>
									<td class="description last">
										<p>Executed while the loading is in progress.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the asset has been loaded.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( data : <span class="param-type"><a href="global.html#any">any</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
					<div class="method">
						<div class="description">
							<p>This method needs to be implemented by all concrete loaders. It holds the
logic for parsing the asset into three.js entities.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>data</strong>
									</td>
									<td class="description last">
										<p>The data to parse.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setCrossOrigin" translate="no">.<a href="#setCrossOrigin">setCrossOrigin</a><span class="signature">( crossOrigin : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the <code>crossOrigin</code> String to implement CORS for loading the URL
from a different domain that allows CORS.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>crossOrigin</strong>
									</td>
									<td class="description last">
										<p>The <code>crossOrigin</code> value.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setPath" translate="no">.<a href="#setPath">setPath</a><span class="signature">( path : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the base path for the asset.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>path</strong>
									</td>
									<td class="description last">
										<p>The base path.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setRequestHeader" translate="no">.<a href="#setRequestHeader">setRequestHeader</a><span class="signature">( requestHeader : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the given request header.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>requestHeader</strong>
									</td>
									<td class="description last">
										<p>A <a href="https://developer.mozilla.org/en-US/docs/Glossary/Request_header" target="_blank" rel="noopener">request header</a>
for configuring the HTTP request.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setResourcePath" translate="no">.<a href="#setResourcePath">setResourcePath</a><span class="signature">( resourcePath : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the base path for dependent resources like textures.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>resourcePath</strong>
									</td>
									<td class="description last">
										<p>The resource path.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setWithCredentials" translate="no">.<a href="#setWithCredentials">setWithCredentials</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Loader.html">Loader</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Whether the XMLHttpRequest uses credentials such as cookies, authorization
headers or TLS client certificates, see <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials" target="_blank" rel="noopener">XMLHttpRequest.withCredentials</a>.</p>
<p>Note: This setting has no effect if you are loading files locally or from the same domain.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>value</strong>
									</td>
									<td class="description last">
										<p>The <code>withCredentials</code> value.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/src/loaders/Loader.js" translate="no" target="_blank" rel="noopener">src/loaders/Loader.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>